include:
  - pkg.pkg-init
redis_dependece:
  pkg.installed:
    - names:
      - jemalloc
redis-user-group:
  group.present:
    - name: redis
    - gid: 988
  user.present:
    - name: redis
    - fullname: redis
    - shell: /sbin/nologin
    - uid: 988
    - gid: 988
redis-install:
  file.managed:
    - name: /usr/local/src/redis-3.2.9.tar.gz
    - source: salt://redis/files/redis-3.2.9.tar.gz
    - user: root
    - group: root
    - mode: 644
  cmd.run:
    - name: cd /usr/local/src && sudo tar xf redis-3.2.9.tar.gz && cd redis-3.2.9 && sudo make PREFIX=/usr/local/redis install
    - unless: test -d /usr/local/redis
    - require:
      - file: redis-install
      - pkg: redis_dependece
